﻿Imports VN.INS.DL.DALC
Imports VN.INS.BL.BE

'SFB: Esta clase contiene las funciones que usan todos los reportes
Public Class ReporteBC

    Public Function RegistroAvance(ByVal strPersona As String, ByVal strPeriodo As String) As DataTable
        Dim objPOADA As ReporteDA
        Dim objDt As DataTable
        Try
            objPOADA = New ReporteDA
            objDt = objPOADA.RegistroAvance(strPersona, strPeriodo)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    'Esta funcion devuelve el monto presupestado de un POA específico, el cual se pasa como parámetro
    Public Function MontoPresupuestado(ByVal strPOA As String) As String
        Dim objPOADA As ReporteDA
        Dim objMonto As String

        Try
            objPOADA = New ReporteDA
            objMonto = objPOADA.MontoPresupuestado(strPOA)
            Return objMonto
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function MontoProgramado(ByVal strPOA As String, ByVal strPeriodo As String) As String
        Dim objPOADA As ReporteDA
        Dim objMonto As String

        Try
            objPOADA = New ReporteDA
            objMonto = objPOADA.MontoProgramado(strPOA, strPeriodo)
            Return objMonto
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function CargaAvanceFinancieroSemanal(ByVal strPoa As String, ByVal strPeriodoActual As String, strPeriodoAnterior As String) As DataTable
        Dim objPOADA As ReporteDA
        Dim objDt As DataTable
        Try
            objPOADA = New ReporteDA
            objDt = objPOADA.CargaAvanceFinancieroSemanal(strPoa, strPeriodoActual, strPeriodoAnterior)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function CargaAvanceFinancieroMensual(ByVal strPoa As String, ByVal strPeriodo As String) As DataTable
        Dim objPOADA As ReporteDA
        Dim objDt As DataTable
        Try
            objPOADA = New ReporteDA
            objDt = objPOADA.CargaAvanceFinancieroMensual(strPoa, strPeriodo)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Sub Insertar_Reporte_Semanal(ByVal PE As String, ByVal PO As String, ByVal PP As String, ByVal EJ As String, ByVal AC As String, ByVal ES As String, _
                                        ByVal PR As Double, ByVal MC As Double, ByVal MD As Double, ByVal MG As Double, ByVal MP As Double, ByVal OB As String, ByVal SE As String, ByVal strPersona As String)
        Dim objReporteDA As ReporteDA
        Try
            objReporteDA = New ReporteDA
            objReporteDA.Insertar_Reporte_Semanal(PE, PO, PP, EJ, AC, ES, PR, MC, MD, MG, MP, OB, SE, strPersona)
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Sub Insertar_Reporte_Mensual(ByVal PE As String, ByVal PO As String, ByVal PP As String, ByVal EJ As String, ByVal AC As String, ByVal ES As String, _
                                        ByVal PR As Double, ByVal MC As Double, ByVal MD As Double, ByVal MG As Double, ByVal MP As Double, ByVal OB As String, ByVal SE As String, ByVal strPersona As String)
        Dim objReporteDA As ReporteDA
        Try
            objReporteDA = New ReporteDA
            objReporteDA.Insertar_Reporte_Mensual(PE, PO, PP, EJ, AC, ES, PR, MC, MD, MG, MP, OB, SE, strPersona)
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Sub Actualizar_Reporte_Semanal(ByVal PE As String, ByVal PO As String, ByVal AC As String, ByVal MC As Double, _
                                        ByVal MD As Double, ByVal MG As Double, ByVal MP As Double, ByVal OB As String, ByVal SE As String, ByVal strPersona As String)
        Dim objReporteDA As ReporteDA
        Try
            objReporteDA = New ReporteDA
            objReporteDA.Actualizar_Reporte_Semanal(PE, PO, AC, MC, MD, MG, MP, OB, SE, strPersona)
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Sub Actualizar_Reporte_Mensual(ByVal PE As String, ByVal PO As String, ByVal AC As String, ByVal MC As Double, _
                                        ByVal MD As Double, ByVal MG As Double, ByVal MP As Double, ByVal OB As String, ByVal SE As String, ByVal strPersona As String)
        Dim objReporteDA As ReporteDA
        Try
            objReporteDA = New ReporteDA
            objReporteDA.Actualizar_Reporte_Mensual(PE, PO, AC, MC, MD, MG, MP, OB, SE, strPersona)
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Function Reporte1(ByVal strPPER As String, ByVal strPeriodo As String, ByVal strRegion As String, ByVal strAmbito As String, ByVal strEjecutor As String, ByVal strTipo As String, ByVal strEsp As String, ByVal strMon As String, ByVal strSem As String) As DataTable
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.Reporte1(strPPER, strPeriodo, strRegion, strAmbito, strEjecutor, strTipo, strEsp, strMon, strSem)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ReporteAFPPER(ByVal strPPER As String, ByVal strPeriodo As String, ByVal strRegion As String, ByVal strAmbito As String, ByVal strEjecutor As String, ByVal strTipo As String, ByVal strEsp As String, ByVal strMon As String, ByVal strSem As String) As DataTable
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.ReporteAFPPER(strPPER, strPeriodo, strRegion, strAmbito, strEjecutor, strTipo, strEsp, strMon, strSem)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ListaPOA_Reporte(ByVal strNombre As String, ByVal strTipo As String, ByVal strPersona As String, ByVal strPeriodo As String, strAnhio As String) As DataTable
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.ListaPOA_Reporte(strNombre, strTipo, strPersona, strPeriodo, strAnhio)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ListaPOA_Mensual(ByVal strNombre As String, ByVal strTipo As String, ByVal strPersona As String, ByVal strPeriodo As String) As DataTable
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.ListaPOA_Mensual(strNombre, strTipo, strPersona, strPeriodo)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function SemaforoPPER(ByVal strPPER As String, ByVal strPeriodo As String, ByVal strRegion As String, ByVal strAmbito As String, ByVal strEjecutor As String, ByVal strTipo As String, ByVal strEsp As String, ByVal strMon As String, ByVal strSem As String) As DataTable
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.SemaforoPPER(strPPER, strPeriodo, strRegion, strAmbito, strEjecutor, strTipo, strEsp, strMon, strSem)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ListaAmbito(ByVal strPPER As String, ByVal strRegion As String) As DataTable
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.ListaAmbito(strPPER, strRegion)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ListaEjecutor(ByVal strPPER As String, ByVal strRegion As String, ByVal strAmbito As String) As DataTable
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.ListaEjecutor(strPPER, strRegion, strAmbito)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ReporteEvolucion(ByVal PeriodoIni As String, ByVal PeriodoFin As String, ByVal Region As String, ByVal Ambito As String, ByVal Ejecutor As String, ByVal Decreto As String, ByVal strAnhioFirma As String) As DataTable
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.ReporteEvolucion(PeriodoIni, PeriodoFin, Region, Ambito, Ejecutor, Decreto, strAnhioFirma)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ReporteEvolucionDevengado(ByVal PeriodoIni As String, ByVal PeriodoFin As String, ByVal Region As String, ByVal Ambito As String, ByVal Ejecutor As String, ByVal Decreto As String, ByVal strAnhioFirma As String) As DataTable
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.ReporteEvolucionDevengado(PeriodoIni, PeriodoFin, Region, Ambito, Ejecutor, Decreto, strAnhioFirma)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ReporteRanking(ByVal Periodo As String) As DataTable
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.ReporteRanking(Periodo)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ListaTipoPPER(ByVal strPeriodo As String, ByVal strPPER As String, ByVal strRegion As String, ByVal strAmbito As String, ByVal strEjecutor As String) As DataTable
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.ListaTipoPPER(strPeriodo, strPPER, strRegion, strAmbito, strEjecutor)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ProductoXPPER(ByVal strPPER As String) As DataTable
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.ProductoXPPER(strPPER)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function POAXPPER(ByVal strPPER As String, ByVal strTipo As String) As DataTable
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.POAXPPER(strPPER, strTipo)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ProyectoXPPER(ByVal strPPER As String) As DataTable
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.ProyectoXPPER(strPPER)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ReporteSabanaDetalle(ByVal strPeriodo As String, ByVal strPPER As String, ByVal strTipo As String, ByVal strCodigo As String, ByVal strRegion As String, ByVal strAmbito As String, ByVal strEjecutor As String) As DataTable
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.ReporteSabanaDetalle(strPeriodo, strPPER, strTipo, strCodigo, strRegion, strAmbito, strEjecutor)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ListaPPER(ByVal strPeriodo As String, ByVal strPPER As String, ByVal strRegion As String, ByVal strAmbito As String, ByVal strEjecutor As String) As DataTable
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.ListaPPER(strPeriodo, strPPER, strRegion, strAmbito, strEjecutor)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ListaTotalSabana(ByVal strPeriodo As String, ByVal strPPER As String, ByVal strRegion As String, ByVal strAmbito As String, ByVal strEjecutor As String)
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.ListaTotalSabana(strPeriodo, strPPER, strRegion, strAmbito, strEjecutor)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ListaPOA_Reporte_Especifico(ByVal strPPER As String, ByVal strNombre As String, ByVal strRegion As String, ByVal strEjecutor As String, ByVal strSemaforo As String, ByVal strPersona As String, ByVal strPeriodo As String, ByVal strOrden As String) As DataTable
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.ListaPOA_Reporte_Especifico(strPPER, strNombre, strRegion, strEjecutor, strSemaforo, strPersona, strPeriodo, strOrden)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function EvolucionPOA(ByVal strPOA As String) As DataTable
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.EvolucionPOA(strPOA)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function CargarAvanceIncompleto(ByVal strPeriodo As String, ByVal strAnhioFirma As String) As DataTable
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.CargarAvanceIncompleto(strPeriodo, strAnhioFirma)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function CargarPoaCompletitud(ByVal strAnhioFirma As String) As DataTable
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.CargarPoaCompletitud(strAnhioFirma)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function Lista_PPER() As DataTable
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.Lista_PPER()
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function Lista_PPER_EJECUTOR(ByVal p_ano As String) As DataTable
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.Lista_PPER_EJECUTOR(p_ano)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function Lista_PPER_REGION(ByVal p_ano As String) As DataTable
        Dim objReporteDA As ReporteDA
        Dim objDt As DataTable
        Try
            objReporteDA = New ReporteDA
            objDt = objReporteDA.Lista_PPER_REGION(p_ano)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

End Class
